#ifndef OPTIONPARSER_H
#define OPTIONPARSER_H

#include <QMap>
#include <QStringList>

class OptionParser
{
public:
    enum OPTION_TYPE
    {
        HELP,
        INSERT,
        MODIFY,
        REMOVE,
        FORMAT,
        OCCUR,
        NAME
    };

    OptionParser(const QStringList &argList);
    bool isOption(OPTION_TYPE type, const QString &arg,
                  Qt::CaseSensitivity sens = Qt::CaseSensitive);
    QString value(OPTION_TYPE option);

    struct Option
    {
        Option() {}
        Option(const QStringList &list) : synonims(list) {}

        QString value;
        QStringList synonims;
    };

    OPTION_TYPE action;

private:
    void initSynonims();
    void parseSubOptions(OPTION_TYPE option, const QString &arg);

    QMap<OPTION_TYPE, Option> options;
};

#endif // OPTIONPARSER_H
